﻿using System;

namespace Aeon.Emulator.Instructions.FPU
{
    internal static class Fscale
    {
        [Opcode("D9FD", OperandSize = 16 | 32, AddressSize = 16 | 32)]
        public static void Scale(VirtualMachine vm)
        {
            double st0 = vm.Processor.FPU.ST0;
            double st1 = Math.Truncate(vm.Processor.FPU.GetRegisterValue(1));

            st0 *= Math.Pow(2.0, st1);

            vm.Processor.FPU.ST0 = st0;
        }
    }
}
